<?php
/**
 * 策略模式也经常和工厂模式一起使用
 */

namespace App\DesignPattern\Strategy;

use App\DesignPattern\Strategy\FemaleUserStrategy;
use App\DesignPattern\Strategy\MaleUserStrategy;

class UserStrategyFactory {

	/**
	 * 用户工厂，返回用户实例
     * @param string $_user_type 用户类型
     * @return FemaleUserStrategy|MaleUserStrategy|null
     */
	public static function create($_user_type = 'male'){
		switch(strtolower($_user_type)){
            case 'female':
                return new FemaleUserStrategy();
            case 'male':
                return new MaleUserStrategy();
			default :
				return null;
		}
	}
}
